package br.com.projetos.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import br.com.projetos.entity.DeclaracaoIR;
import br.com.projetos.entity.Nomeado;

public class DeclaracaoIRDAO extends DAO {

	private static DeclaracaoIRDAO instance;

	private DeclaracaoIRDAO() {
	}

	public static DeclaracaoIRDAO getInstance() {
		if (instance == null) {
			instance = new DeclaracaoIRDAO();
		}
		return instance;
	}



	public DeclaracaoIR buscaDeclaracaoIRByNomeado(Nomeado nomeado) {
		HibernateUtility.beginTransaction();
		Criteria c = HibernateUtility.getSession()
				.createCriteria(DeclaracaoIR.class);
		c.add(Restrictions.eq("nomeado", nomeado));
		HibernateUtility.commitTransaction();
		return (DeclaracaoIR) c.uniqueResult();
	}

}